include $(top_srcdir)/Makefile.decl

NULL = 

CLEANFILES =

lib_LTLIBRARIES = \
	libbump@BUMP_API_VERSION@.la \
	$(NULL)

libbump@BUMP_API_VERSION@_la_SOURCES = \
	bump-async-priority-queue.vala \
	bump-callback-queue.vala \
	bump-claim.vala \
	bump-event.vala \
	bump-factory.vala \
	bump-lazy.vala \
	bump-queue.vala \
	bump-resource-claim.vala \
	bump-resource-pool.vala \
	bump-semaphore.vala \
	bump-semaphore-claim.vala \
	bump-task-queue.vala \
	bump-threading.vala \
	$(NULL)

if HAVE_INTROSPECTION
GIR_BUMP_VALAFLAGS = \
	--gir Bump-@BUMP_API_VERSION@.gir \
	$(NULL)
else
GIR_BUMP_VALAFLAGS =
endif

.gitignore: .gitignore.in
	$(AM_V_GEN) echo "# Automatically generated from $^. Do not edit." > $@ && \
	cat < $^ >> $@ && \
	for ignored_file in $(libbump@BUMP_API_VERSION@_la_SOURCES:.vala=); do \
	  echo /$$ignored_file.c >> $@; \
	  echo /libbump@BUMP_API_VERSION@_la-$$ignored_file.lo >> $@; \
	  echo /libbump@BUMP_API_VERSION@_la-$$ignored_file.o >> $@; \
	done

libbump@BUMP_API_VERSION@_la_PKG_DEPENDS = \
	gio-2.0 \
	gobject-2.0 \
	glib-2.0 \
	$(GEE_PACKAGE) \
	$(NULL)

bump-@BUMP_API_VERSION@.deps:
	$(AM_V_GEN) for pkg_config_name in $(libbump@BUMP_API_VERSION@_la_PKG_DEPENDS); do \
	  echo $$pkg_config_name >> $@; \
	done

libbump@BUMP_API_VERSION@_la_VALAPKGFLAGS = $(foreach pkg_config_name,$(libbump@BUMP_API_VERSION@_la_PKG_DEPENDS),--pkg $(pkg_config_name))

if ENABLE_VALADOC
devhelp html: $(libbump@BUMP_API_VERSION@_la_SOURCES)
	$(AM_V_GEN) $(VALADOC) --force -o $@/ \
	  --target-glib $(GLIB_TARGET_VERSION) \
	  --package-name=bump-@BUMP_API_VERSION@ \
	  --package-version=@BUMP_API_VERSION@ \
	  --doclet $@ \
	  $(libbump@BUMP_API_VERSION@_la_VALAPKGFLAGS) \
	  $(libbump@BUMP_API_VERSION@_la_SOURCES)

gtkdoc: $(libbump@BUMP_API_VERSION@_la_SOURCES)
	$(AM_V_GEN) $(VALADOC) --force -o $@/ \
	  --target-glib $(GLIB_TARGET_VERSION) \
	  --package-name=bump \
	  --package-version=@BUMP_API_VERSION@ \
	  --doclet $@ \
	  $(libbump@BUMP_API_VERSION@_la_VALAPKGFLAGS) \
	  $(libbump@BUMP_API_VERSION@_la_SOURCES) \
	  -X --ignore-headers \
	  -X $(srcdir)/bump-@BUMP_API_VERSION@-internal.h \
	  -X $(srcdir)/bump.h \
	  -X -l -X $(builddir)/.libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}/libbump@BUMP_API_VERSION@.so
endif

libbump@BUMP_API_VERSION@_la_VALAFLAGS = \
	$(GIR_BUMP_VALAFLAGS) \
	--library bump-@BUMP_API_VERSION@ \
	--target-glib $(GLIB_TARGET_VERSION) \
	--vapi bump-@BUMP_API_VERSION@.vapi \
	-H bump.h \
	--use-header \
	--internal-header bump-@BUMP_API_VERSION@-internal.h \
	--vapidir $(top_srcdir)/bump \
	$(libbump@BUMP_API_VERSION@_la_VALAPKGFLAGS) \
	$(NULL)

libbump@BUMP_API_VERSION@_la_CFLAGS = \
	$(GIO_CFLAGS) \
	$(GLIB_CFLAGS) \
	$(GOBJECT_CFLAGS) \
	$(GEE_CFLAGS) \
	$(NULL)

libbump@BUMP_API_VERSION@_la_LDFLAGS = \
	$(GIO_LIBS) \
	$(GLIB_LIBS) \
	$(GOBJECT_LIBS) \
	$(GEE_LIBS) \
	$(NULL)

bumpincludedir = $(includedir)/bump/bump-$(BUMP_API_VERSION)
bumpinclude_HEADERS = \
	bump.h \
	$(NULL)

vapidir = $(datadir)/vala/vapi
vapi_DATA = \
	bump-@BUMP_API_VERSION@.vapi \
	bump-@BUMP_API_VERSION@.deps \
	$(NULL)

if HAVE_INTROSPECTION
# Install the GIR and typelib files to the correct
# location. $(INTROSPECTION_GIRDIR) is filled in by the macro in
# introspection.m4.

girdir = $(INTROSPECTION_GIRDIR)
gir_DATA = Bump-$(BUMP_API_VERSION).gir

# Compile all the GIR files listed above (only one in this case) to
# typelibs and install them to the correct location. Again, the
# installation directory is filled in by the macro in
# introspection.m4.

typelibsdir = $(INTROSPECTION_TYPELIBDIR)
typelibs_DATA = $(gir_DATA:.gir=.typelib)

# Compile the GIR to a typelib. The only really interesting thing here
# is the --shared-library argument. Vala doesn't write the shared
# library information to the GIR since it doesn't know what it will
# be, whereas GIRs generated by g-ir-scanner do have this information
# included.

%.typelib: %.gir $(INTROSPECTION_COMPILER)
	$(AM_V_GEN) LD_LIBRARY_PATH=.libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} \
	$(INTROSPECTION_COMPILER) \
		--includedir=$(srcdir) \
		--includedir=. \
		--shared-library=bump@BUMP_API_VERSION@ \
		$(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)

CLEANFILES += \
	$(typelibs_DATA) \
	$(NULL)

endif # HAVE_INTROSPECTION

MAINTAINERCLEANFILES = \
	bump.h \
	bump-@BUMP_API_VERSION@.vapi \
	$(NULL)

BUILT_SOURCES = .gitignore

EXTRA_DIST += \
	bump.h \
	bump-@BUMP_API_VERSION@.vapi \
	bump-@BUMP_API_VERSION@.deps \
	$(NULL)

if ENABLE_VALADOC
EXTRA_DIST += devhelp

install-data-hook: devhelp
	$(MKDIR_P) $(DESTDIR)$(datadir)/devhelp/books/Bump/img
	$(INSTALL_DATA) -t $(DESTDIR)$(datadir)/devhelp/books/Bump devhelp/bump/*.*
	$(INSTALL_DATA) -t $(DESTDIR)$(datadir)/devhelp/books/Bump/img devhelp/bump/img/*

uninstall-hook:
	rm -rf $(DESTDIR)$(datadir)/devhelp/books/Bump

maintainer-clean-local:
	-rm -rf devhelp
endif
